package com.ruoyi.web.controller.byManager;

import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.ByParam;
import com.ruoyi.system.mapper.ByParamMapper;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 新闻消息发布Controller
 *
 * @author ruoyi
 * @date 2023-06-18
 */
@RestController
@RequestMapping("/by/param")
public class ByParamController {

    @Autowired
    private ByParamMapper paramMapper;


    @PostMapping("getParamByPid")
    public AjaxResult getParamByPid(@RequestBody String param){
        JSONObject json = JSONObject.parseObject(param);
        String pid = json.getString("pid");
        if(StringUtils.isEmpty(pid)){
            return AjaxResult.success();
        }
        List<JSONObject> list = paramMapper.getParamByPid(pid);


        return AjaxResult.success(list);
    }

}
